<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@include file="/common/common.jspf"%>
	<script type="text/javascript" src="${ctx}/js/system/user/myadd.js">

	</script>
    <link href="${ctx}/css/switcher.css" rel="stylesheet">
	<style type="text/css">
		.col-sm-3 {
			position: relative;
			top: 8px;
			width: 20%;
			float: left;
			text-align: right;
		}

		.col-sm-9 {
			width: 50%;
			float: left;
			text-align: left;
		}


		label[class^="btn btn-default"] {
			margin-top: -4px;
		}
	</style>
</head>
<body>
<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
<form id="form" name="form" class="form-horizontal" method="post"
	  action="${ctx}/mq/editMq.shtml">
	<input type="hidden" class="form-control checkacc" value="${mq.id}"
		   name="materialQualityForMap.id" id="id">
	<section class="panel panel-default">
		<div class="panel-body">
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">来料质检编号</label>
			<div class="col-sm-9">
				<input type="text" class="form-control checkabh" value="${mq.detection_code}"
					   placeholder="" name="materialQualityForMap.detection_code" id="detection_code" readonly = "readonly">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">物料编号</label>
			<div class="col-sm-9">
				<input type="text" class="form-control checkName" readonly = "readonly" value="${mq.material_code}"
					   placeholder="" name="materialQualityForMap.material_code" id="material_code" >
				<span class="input-group-btn">
						<button class="btn btn-info" type="button"
								style="height: 34px; position: absolute; top: -35px; left: 338px;"
								onclick="getItemMain('material_code','item_name');">
							<span class="glyphicon glyphicon-search"></span>
						</button>
					</span>
			</div>
		</div>
		<%--<div class="form-group">--%>
			<%--<label class="col-sm-3 control-label">检验项目</label>--%>
			<%--<div class="col-sm-9">--%>
				<%--<div class="input-group">--%>
					<%--<input type="text" class="form-control" placeholder="" readonly = "readonly" value="${mq.detection_project}"--%>
						   <%--name="materialQualityForMap.detection_project" id="detection_project">--%>
					<%--<span class="input-group-btn">--%>
						<%--<button class="btn btn-info" id="workorder" type="button"--%>
								<%--style="height: 34px;"--%>
								<%--onclick="getDetection();">--%>
							<%--<span class="glyphicon glyphicon-search"></span>--%>
						<%--</button>--%>
					<%--</span>--%>
				<%--</div>--%>
			<%--</div>--%>
		<%--</div>--%>


		<div class="form-group">
			<label class="col-sm-3 control-label">抽检数</label>
			<div class="col-sm-9">
				<input type="text" class="form-control" value="${mq.sampling}"
					   name="materialQualityForMap.sampling"
					   id="sampling">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">不合格数</label>
			<div class="col-sm-9">
				<input type="text" class="form-control checkName" value="${mq.unqalified}"
					   placeholder="" name="materialQualityForMap.unqalified" id="unqalified">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">合格率</label>
			<div class="col-sm-9">
				<input type="text" class="form-control checkName" value="${mq.percent_pass}"
					   placeholder="" name="materialQualityForMap.percent_pass" id="percent_pass" readonly = "readonly">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">检验时间</label>
			<div class="col-sm-9">
				<input type="date" class="form-control" value="${mq.detection_time}"
					   name="materialQualityForMap.detection_time"
					   id="detection_time">
			</div>
		</div>



		<div class="form-group">
			<label class="col-sm-3 control-label">检验人</label>
			<div class="col-sm-9">
				<input type="text" class="form-control checkName" value="${mq.surveyor}"
					   placeholder="" name="materialQualityForMap.surveyor" id="surveyor">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">检验结果</label>
			<div class="col-sm-9">
				<select class="form-control" name="materialQualityForMap.the_result" id="the_result" value="${mq.the_result}" >
					<option value="0">通过</option>
					<option value="1">未通过</option>
				</select>
			</div>
		</div>

		</div>
		<footer class="panel-footer text-right bg-light lter">
			<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer>
	</section>
</form>


<table id="table_Id"  class="bTable table table-striped table-bordered table-hover table-condensed">
	<thead>
	<tr>
        <th>id</th>
		<th>检验内容</th>
		<th>检验标准</th>
		<th>检验记录</th>
		<th>不合格数量</th>
		<th>合格数量</th>
		<th>结果判定</th>
	</tr>
	<c:forEach var="mc" items="${cd}" varStatus="userStatus">
		<c:choose>
			<c:when test="${userStatus.index == 0}">
				<tr id="myfirst">
					<td id="${userStatus.index}">${mc.materialId}</td>
                    <td>${mc.ly_content}</td>
					<td>测试</td>
					<td><input id="record${userStatus.index}" style= "background-color:transparent;border:0;width: 56px"  value="${mc.record}"></td>
					<td><input id="no_number${userStatus.index}" style= "background-color:transparent;border:0;width: 85px" value="${mc.no_number}"></td>
					<th rowspan="100" style="text-align: center; vertical-align: middle;" ><input  style= "background-color:transparent;border:0;width: 50px"  id="qualified" value="${mc.qualified}"></th>
					<th rowspan="100" style="text-align: center; vertical-align: middle;"><div class="form-check form-check-inline">
						<input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1" checked ='checked'>
					</div>
					</th>
				</tr>
			</c:when>
			<c:otherwise>
				<tr id="mytow">
					<td id="${userStatus.index}">${mc.materialId}</td>
                    <td>${mc.ly_content}</td>
					<td>测试</td>
					<td><input id="record${userStatus.index}" style= "background-color:transparent;border:0;width: 56px"  value="${mc.record}"></td>
					<td><input id="no_number${userStatus.index}" style= "background-color:transparent;border:0;width: 85px"  value="${mc.no_number}"></td>
				</tr>
			</c:otherwise>
		</c:choose>
	</c:forEach>
	</thead>
	<tbody id="addBody">
	</tbody>
</table>

<script src="${ctx}/js/public/jquery.switcher.js"></script>
<script type="text/javascript">
    $.switcher();
	onloadurl();
</script>

<script type="text/javascript"
		src="${ctx}/notebook/notebook_files/bootstrap-filestyle.min.js"></script>
<script type="text/javascript">
	//检测数据input数据状态
	$("#unqalified").bind("input propertychange",function(event){
		//获取sampling 数据
		var sa = $("#sampling").val();
		//判断sa是否有数据
		if(sa==''||sa==undefined||sa==null ){
			return;
		}
		var num = parseInt(sa);
		var num2 = parseInt($("#unqalified").val());
		$("#percent_pass").val((100 - (Math.round(num2 / num * 10000) / 100)) + "%");
	});

	//插入数据
	function inser_data(data) {
		var name =  $("#detection_project").val();
		if(name==''||name==undefined||name==null ){
			$("#detection_project").val(data);
		}else {
			$("#detection_project").val(name +","+ data);
		}

	}

	function getDetection() {
		layer.open({
			title : "检测项目信息列表",
			type : 2,
			area : [ "80%", "80%" ],
			content : rootPath + '/base/getDetection.shtml'
		});
	}


</script>
</body>
</html>